package com.scm.crm.frameworks.service;

import com.scm.crm.frameworks.config.HibernateConfig;
import com.scm.crm.frameworks.pojo.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author lvxiucai
 * @description
 * @date 2020/10/22
 */
@Service
public class UserServiceImpl implements UserService{

    @Resource
    private HibernateConfig hibernateConfig;

    @Override
    public void saveStu(User student) {

        try {
//            int x = 100/0;
            hibernateConfig.HibernateSession().save(student);
            hibernateConfig.HibernateTransaction().commit();
        }catch (Exception e){
            e.printStackTrace();
            hibernateConfig.HibernateTransaction().rollback();
        }
    }
}
